var app = sm("do_App");
var page = sm("do_Page");
var nf = sm("do_Notification");
var openHelper = require("helper/open");
var httpSilence = require("helper/httpSilence");
var communityUtil = require("helper/community");
var userUrl = require("url/user");
var mallUrl = require("url/mall");
// 社区头部
var headerAout = ui("headerAout");
var addheader = headerAout.add("header", "source://view/reuse/header.ui", 0, 0);
ui(addheader+".labelTitle").text = "我的圈币";
//左上角-返回
var headerLeft = ui(addheader+".headerLeft");
headerLeft.on("touch", function() {
    app.closePage();
});
//右上角-
var headerRight = ui(addheader + ".headerRight");
//右上角添加+图标
var labelNext = ui(addheader + ".labelNext");
labelNext.text = "明细";
labelNext.visible = true;
headerRight.on("touch", function(data) {
	openHelper.open("source://view/user/money/quanList.ui");
});

var do_Button_1=ui("do_Button_1");
var do_Button_2=ui("do_Button_2");
do_Button_1.on("touch", function(data) {
	httpSilence.post(mallUrl.url.shop.getQshop, {communityId:communityUtil.communityVisitId()}, function(data) {
		if(null!=data.qShop){
			openHelper.open("source://view/qshop/detail/main.ui",{shopId:data.qShop.id});
		}else{
			app.fire("fireShowView", 2);//去发现
			app.closePage();
		}
	});
});
do_Button_2.on("touch", function(data) {
	openHelper.open("source://view/coupon/new/list.ui");
});
//andriod返回键
page.on("back", function() {
    app.closePage();
});
//页面装载完成后，开始初始化工作
page.on("loaded", function() {
	getUserInfo();
});
function getUserInfo(){
	httpSilence.post(userUrl.url.base.get, {}, function(data) {
		ui("do_Label_1").text=data.userValueVo.quanValue;
	});
}